﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EveruComponent.Parser.BBCode
{
    public class BBElement
    {
        public List<IBBTag> Tags;

        public string Text
        {
            get;
            set;
        }

        public bool HasTag(string Tag)
        {
            if (Tags == null)
                return false;

            var query = from o in Tags where o.Tag.ToLower() == Tag.ToLower() select o;
            if (query.Count() > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public IBBTag GetTag(string Tag)
        {
            if (Tags == null)
                return null;

            var query = from o in Tags where o.Tag.ToLower() == Tag.ToLower() select o;
            if (query.Count() > 0)
            {
                return query.First();
            }
            else
            {
                return null;
            }
        }

    }
}
